﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;
using System.Net;

namespace FY2013.Business
{
    public class MailHelper
    {

        public MailHelper()
        {

        }

        public static void SendEmail(string mailTo, string mailSubject, string mailBody)
        {
            SmtpClient client = new SmtpClient();

            client.Host = BusinessSettings.Default.SmtpServer;
            client.UseDefaultCredentials = false;
            client.Credentials = new NetworkCredential(BusinessSettings.Default.SmtpAccount, BusinessSettings.Default.SmtpPassword);

            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            MailMessage message = new MailMessage(BusinessSettings.Default.SmtpAccount, mailTo);
            message.Subject = mailSubject;
            message.Body = mailBody;
            message.BodyEncoding = Encoding.UTF8;
            message.IsBodyHtml = true;

            client.Send(message);
        }
    }
}
